package com.peng.event;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 * @author : pengyf
 * @version : 1.0
 * @createTime : 2022/1/22 12:19
 * @Description : TODO
 */
public class WakGnTabPanelChangeListener implements ChangeListener {
    @Override
    public void stateChanged(ChangeEvent e) {
        JTabbedPane jTabbedPane = (JTabbedPane) e.getSource();
        int selectedIndex = jTabbedPane.getSelectedIndex();
        if (selectedIndex != 0) {
            // ((JPanel) jTabbedPane.getSelectedComponent()).getName()
            JOptionPane.showMessageDialog(null, "第"+(selectedIndex+1)+"个tab被打开了");
        }
    }
}
